from org.eclipse.swt.browser import Browser
from org.eclipse.swt import SWT
from org.eclipse.ui import PlatformUI
from org.jyrcp.base import ViewCreator

from listeners.selection_listener import SelectionListener

class BrowserView(ViewCreator):
    def createPartControl(self, parent):
        browser = Browser(parent, 0)
        browser.url = 'http://www.google.com/'
        
        PlatformUI.getWorkbench().activeWorkbenchWindow.selectionService.addSelectionListener(SelectionListener(browser))
        
        return browser